package com.ymatou.iapi.productquery.testcase;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.shop2cn.iapi.activitymgt.parameter.AddactivityBean;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.parameter.productdetail.ProductDetailDto2;
import com.ymatou.iapi.productprice.parameter.ProductAllPriceBean;
import com.ymatou.iapi.productquery.parameter.ApplyActivityDto;
import com.ymatou.iapi.productquery.parameter.ProductDetail.ProductInDetailBean;
import com.ymatou.iapi.productquery.service.GetProductDetailListByProductIdListCall;
import com.ymatou.iapi.productquery.service.GetProductDetailListByTradeIsolationCall;
import com.ymatou.iapi.sellerproduct.service.BatchDeleteProductsCall;
import com.ymatou.iapi.sellerproduct.service.ChangeNewProductInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;
import com.ymttest.database.mongo.jproduct.ActivityProductsWapper;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.utils.*;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

public class Ts_GetProductDetailListByProductIdList {
	private static GetProductDetailListByProductIdListCall getProductDetailListByProductIdListCall = new GetProductDetailListByProductIdListCall();
	private static GetProductDetailListByTradeIsolationCall getProductDetailListByTradeIsolationCall = new GetProductDetailListByTradeIsolationCall();
	private static ProductPriceCallService priceCallService = new ProductPriceCallService();

	private static Integer sellerId = Integer.valueOf(EnvSetup.getData("productpriceSellerId"));
	private static String sellerName = EnvSetup.getData("productpriceSellerName");	
	
	private static ActivityProductsWapper activityProductsWapper = new ActivityProductsWapper();
	
	//vip渠道
		private static int vipRootUserId = AgentUsers.vipRootUserId;
		private static String vipRootUserName = "NickautoTest";
		//vip渠道->代理1
		private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
		private static String vipAgentUserName1 = "dgsq408897016";
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("非交易隔离查询接口,获取商品详细信息");
		try {
			GodfreightmgrService.deleteBySellerId(rootUserId);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getProductDetailListByProductIdListCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	

	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_001() {
		Logger.start(true,"普通单规格商品，普通单规格直播商品 查询");
		try {
			//发布商品
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Tc2.json");
			JsonBeanHelper.updateJsonBean(addProductBean, MapUtil.hashMap("UserID", sellerId,"LoginID", sellerName));
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			List<String> prodList = Arrays.asList(productId);
			
			YMTDateUtil.waitTime(3);
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,liveId,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,liveId,true,true);
			
			
			//================================================================================
			//结束直播
			LiveCallService.closeLive(liveId, Integer.valueOf(sellerId));
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			//================================================================================
			//加入未开始直播
			liveId = LiveCallService.createLiveBeginInFuture(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_002() {
		Logger.start(true,"普通多规格商品,普通多规格直播商品 查询");
		try {
			String productId = ProductQueryCallService.getNewProduct(sellerId, sellerName);
				
			List<String> prodList = Arrays.asList(productId);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,liveId,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,liveId,true,true);
			
			//================================================================================
			//暂停销售
			SellerProductCallService.suspendSaleProductInLive(sellerId, liveId, productId);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
		}catch(Exception e ){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_003() {
		Logger.start(true,"普通活动商品查询");
		
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId).getProductId();
			
			List<String> prodList = Arrays.asList(productId);
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,inaid,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,inaid,0,0,true,true);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(-100))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_004() {
		Logger.start(true,"交易隔离活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndIsolation(sellerId).getProductId();
			//String productId = "191d3725-9f21-4f92-bc9e-8d8f41d0aadd";
			List<String> prodList = Arrays.asList(productId);						
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,inaid,0,0,true,true);
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(-100))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_005() {
		Logger.start(true,"活动直播商品查询");
		try {
			String productId = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId).getProductId();
			List<String> prodList = Arrays.asList(productId);											
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			
			//================================================================================
			//加入直播
			int liveId = LiveCallService.createLiveInProgress(sellerName, Integer.valueOf(sellerId)).getJSONObject("Data").getInt("ActivityId");
			SellerProductCallService.addProductInLive(sellerId, liveId, productId);
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,inaid,0,liveId,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,inaid,0,liveId,true,true);
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_006() {
		Logger.start(true,"普通多规格商品，增加规格");
		try {
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			List<String> prodList = Arrays.asList(productId);	
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			
			String fileName = "changenewproductinfocalltpl_003.json";
			new ChangeNewProductInfoCall().callAndGetReturnData(fileName,MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,
																"Product->sProductId",productId,"ProductID",productId));

			
			YMTDateUtil.waitTime(5);
			
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			

		}catch(Exception e){
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_007() {
		Logger.start(true,"普通下一场会员活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId,MapUtil.hashMap("ActivityTemplateId", 1));
			
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",false));
			}
			
			
			List<String> prodList = Arrays.asList(productId);
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,inaid,0,false,false);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,inaid,0,true,false);
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_008() {
		Logger.start(true,"交易隔离下一场活动商品查询");
		int activityId = 0;
		try {
			String productId = ProductPriceCallService.getProductIdWithAllPrice();
			
			ProductPriceCallService.getProdPriceWithActivityInFuture(sellerId,productId,MapUtil.hashMap("ActivityTemplateId", 1));
			
			if (YmtMongoDriverFactroy.IsNewJavaMongoOpen){
				new ActivityProductsWapper().update(productId, MapUtil.hashMap("nbuyer",true,"isolation",true));
			}
			
			
			List<String> prodList = Arrays.asList(productId);
			
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,inaid,0,true,true);
			
			
			
			//结束活动
			//activityProductsWapper.update(inaid, MapUtil.hashMap("end",YMTDateUtil.getBeforeOrNextDate(1))); 
			AdminCallService.closeProductInActivity(String.valueOf(inaid));
			
			//================================================================================
			//check GetProductDetailListByProductIdListCall
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductDetailListByTradeIsolationCall
			checkByProductId(prodList,0,0,0,true,true);
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_009() {
		Logger.start(true,"查询商品删除");
		try {
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl_Tc2.json");
			JsonBeanHelper.updateJsonBean(addProductBean, MapUtil.hashMap("UserID", sellerId,"LoginID", sellerName));
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			//删除商品
			new BatchDeleteProductsCall().callAndGetReturnData(MapUtil.hashMap("ProductIds", new JSONArray(Arrays.asList(productId)), "UserID", sellerId));
			YMTDateUtil.waitTime(2);
			JSONObject ret1 = getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			Logger.verifyEquals(true,ret1.isNull("Data"), "删除商品应查出");
			
			
			JSONObject ret2 = getProductDetailListByTradeIsolationCall.search(Arrays.asList(productId));
			Logger.verifyEquals(true,ret2.isNull("Data"), "删除商品应查出");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_010() {
		Logger.start(true, "普通活动商品查询,库存为0");
		int activityId = 0;
		try{
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndNoIsolation(sellerId);
			String productId =productAllPriceBean.getProductId();
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<String> prodList = Arrays.asList(productId);
			
			//check GetProductInfoByProductId
			checkByProductId(prodList,inaid,0,0,false,true);
			
			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,inaid,0,0,true,true);
			
			//活动库存为0 就移到下一场活动
			ProductPriceCallService.updateActivityStockTo0InMgo(productAllPriceBean, inaid);
			ProductManagerCallServiceV3.updateProductRedisTimeStamp(productId);
			
			//check GetProductInfoByProductId
			checkByProductId(prodList,-1*inaid,0,0,false,true);
			
			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,-1*inaid,0,0,true,true);
			
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_011() {
		Logger.start(true, "交易隔离活动商品查询,库存为0");
		int activityId = 0;
		try{
			ProductAllPriceBean productAllPriceBean = ProductPriceCallService.getProdPriceWithActivity_NoNewBuyerAndIsolation(sellerId);
			String productId =productAllPriceBean.getProductId();
			int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
			activityId = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("aid").toString());
			
			List<String> prodList = Arrays.asList(productId);
			
			//check GetProductInfoByProductId
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,inaid,0,0,true,true);
			
			//活动库存为0 就移到下一场活动
			ProductPriceCallService.updateActivityStockTo0InMgo(productAllPriceBean, inaid);ProductManagerCallServiceV3.updateProductRedisTimeStamp(productId);
			
			//check GetProductInfoByProductId
			checkByProductId(prodList,0,0,0,false,true);
			
			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,-1*inaid,0,0,true,true);
			
			
		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_012() {
		Logger.start(true, "非交易隔离活动商品查询,不忽略大促配置，IgnoreActivityConf为true，下一场露出高优先级活动");
		int activityId = 0;
		try{
			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			//String productId = ProductManagerCallServiceV2.addNewProduct(addpro).get("Data").getAsJsonObject().get("ProductId").getAsString();
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			String price1 = "9.0";
			String price2 = "8.0";
			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

			List<Integer> activitys = new ArrayList<>();
			activitys.add(applyActivityDto1.getActivityId());
			activitys.add(applyActivityDto2.getActivityId());
			ProductQueryCallService.updateActivityConfig(activitys);
			YMTDateUtil.waitTime(10);

			List<String> prodList  = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,Integer.valueOf(applyActivityDto1.getAids().get(0)),0,false,true);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_013() {
		Logger.start(true, "交易隔离活动商品查询,不忽略大促配置，商品报名多个活动，活动时间重合，IgnoreActivityConf为true，下一场露出高优先级活动");
		int activityId = 0;
		try{
			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			String price1 = "9.0";
			String price2 = "8.0";
			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

			List<Integer> activitys = new ArrayList<>();
			activitys.add(applyActivityDto1.getActivityId());
			activitys.add(applyActivityDto2.getActivityId());
			ProductQueryCallService.updateActivityConfig(activitys);
			YMTDateUtil.waitTime(10);

			List<String> prodList  = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,Integer.valueOf(applyActivityDto1.getAids().get(0)),0,true,true);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_GetProductDetailListByProductIdList_014() {
//		Logger.start(true, "非交易隔离活动商品查询,不忽略大促配置，IgnoreActivityConf为true，下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动开始时间超过大促配置的露出时间，下一场活动露出低优先级活动");
//		int activityId = 0;
//		try{
//			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
//			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
//			String price1 = "9.0";
//			String price2 = "8.0";
//			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(5));
//			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
//			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
//			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
//			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
//			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);
//
//			List<Integer> activitys = new ArrayList<>();
//			activitys.add(applyActivityDto1.getActivityId());
//			activitys.add(applyActivityDto2.getActivityId());
//			ProductQueryCallService.updateActivityConfig(activitys);
//			YMTDateUtil.waitTime(10);
//
//			List<String> prodList  = new ArrayList<>();
//			prodList.add(productId);
//
//			//check GetProductInfoByTradeIsolation
//			checkByProductId(prodList,0,Integer.valueOf(applyActivityDto2.getAids().get(0)),0,false,false);
//
//
//		}catch(Exception e){
//			Logger.fail(e);
//		}finally{
//			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
//		}
//	}


	@Test
	@Category(P1.class)
	@TestCase
	@Ignore //手动校验
	public void Tc_GetProductDetailListByProductIdList_017() {
		Logger.start(true, "交易隔离活动商品查询,不忽略大促配置，IgnoreActivityConf为true，下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动开始时间超过大促配置的露出时间，下一场活动露出低优先级活动");
		int activityId = 0;
		try{
			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			String price1 = "9.0";
			String price2 = "8.0";
			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(5));
			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

			List<Integer> activitys = new ArrayList<>();
			activitys.add(applyActivityDto1.getActivityId());
			activitys.add(applyActivityDto2.getActivityId());
			ProductQueryCallService.updateActivityConfig(activitys);
			YMTDateUtil.waitTime(10);

			List<String> prodList  = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,Integer.valueOf(applyActivityDto2.getAids().get(0)),0,true,false);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	@Ignore //手动校验
	public void Tc_GetProductDetailListByProductIdList_015() {
		Logger.start(true, "非交易隔离活动商品查询,不忽略大促配置，IgnoreActivityConf为true，下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动和低优先级活动的开始时间都超过大促配置的露出时间，下一场活动不露出");
		int activityId = 0;
		try{
			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			String price1 = "9.0";
			String price2 = "8.0";
			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

			List<Integer> activitys = new ArrayList<>();
			activitys.add(applyActivityDto1.getActivityId());
			activitys.add(applyActivityDto2.getActivityId());
			ProductQueryCallService.updateActivityConfigV2(activitys);
			YMTDateUtil.waitTime(10);

			List<String> prodList  = new ArrayList<>();
			prodList.add(productId);

			getProductDetailListByProductIdListCall.searchByActivityConf(prodList,false);
			List<ProductInDetailBean> products = getProductDetailListByProductIdListCall.getProductList();

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,0,0,false,false);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore //手动校验
	public void Tc_GetProductDetailListByProductIdList_016() {
		Logger.start(true, "交易隔离活动商品查询,不忽略大促配置，IgnoreActivityConf为true，下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动和低优先级活动的开始时间都超过大促配置的露出时间，下一场活动不露出");
		int activityId = 0;
		try{
			AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			String price1 = "9.0";
			String price2 = "8.0";
			Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
			Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
			ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
			ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

			List<Integer> activitys = new ArrayList<>();
			activitys.add(applyActivityDto1.getActivityId());
			activitys.add(applyActivityDto2.getActivityId());
			ProductQueryCallService.updateActivityConfigV2(activitys);
			YMTDateUtil.waitTime(10);

			List<String> prodList  = new ArrayList<>();
			prodList.add(productId);

			getProductDetailListByTradeIsolationCall.searchByActivityConf(prodList,false);
			List<ProductDetailDto2> products = getProductDetailListByTradeIsolationCall.getProductList();

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,0,0,true,false);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_018() {
		Logger.start(true, "商品拼邮国内发货");
		int activityId = 0;
		try{
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addSellerProductRequest.getProduct().setPackageDeliveryType(2);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);
			List<String> prodList = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,0,0,false,false);


		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_019() {
		Logger.start(true, "商品拼邮国外发货");
		int activityId = 0;
		try{
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			addSellerProductRequest.getProduct().setPackageDeliveryType(1);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);
			List<String> prodList = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,0,0,false,false);

		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_020() {
		Logger.start(true, "全球优选商品,优选团商品");
		int activityId = 0;
		try{
			int sellerId = 20336378;
			AddSellerProductRequest addpro = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(sellerId,productId,2);
			List<String> catalogIds = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(x->x.getsCatalogId()).collect(Collectors.toList());

			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(sellerId,productId,catalogIds.get(0),addpro.getSellerName(),Arrays.asList(new BigDecimal(10),new BigDecimal(9),new BigDecimal(8)));
			Thread.sleep(2000);

			List<String> prodList = new ArrayList<>();
			prodList.add(productId);

			//check GetProductInfoByTradeIsolation
			checkByProductId(prodList,0,0,0,false,false);

		}catch(Exception e){
			Logger.fail(e);
		}finally{
			if (activityId>0){ActivityPoolService.removeActivityIdFromPool(activityId);}
		}
	}
	//渠道商
	private static int rootUserId = AgentUsers.rootUserId;
	private static String rootUserName = "NickautoTest";	

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_021() {
		Logger.start(true, "查询限时抢八折后价格");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					rootUserName, false);
			double price = 123.6;
			addAgentProductBean.getCatalogList().forEach(a -> {
				a.getAgentPriceList().forEach(b -> {
					b.setAgentPrice(price);
				});
				a.setDirectPrice(price);
			});
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 创建限时抢购活动
			List<String> catalogList = new ArrayList<String>();
			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(rootUserId,
					productId);
			selectProductDetails.getCatalogList().forEach(a -> {
				catalogList.add(a.getCatalogId());
			});
			List<String> catalogs = new ArrayList<String>();

			AddactivityBean initProductaddactivity = AgentProductCallService.initProductaddactivity(rootUserId,
					productId, catalogList);
			initProductaddactivity.getProductList().forEach(a -> {
				a.getCatalogList().forEach(b -> {
					catalogs.add(b.getCatalogId());
					b.setDiscount(new BigDecimal("8"));
				});
			});
			int activityId = AgentProductCallService.agentProductaddactivity(initProductaddactivity);
			Thread.sleep(4000);
			JSONObject callAndGetReturnData = getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JSONObject asJsonObject1 = callAndGetReturnData.getJSONObject("Data").getJSONArray("ProductList")
					.getJSONObject(0).getJSONArray("CatalogList").getJSONObject(0);
			JSONObject asJsonObject2 = callAndGetReturnData.getJSONObject("Data").getJSONArray("ProductList")
					.getJSONObject(0).getJSONArray("CatalogList").getJSONObject(1);
			Logger.verifyEquals(price, asJsonObject1.getDouble("Price"), "验证是否为八折价格");
			Logger.verifyEquals(price, asJsonObject2.getDouble("Price"), "验证是否为八折价格");
			Logger.verifyEquals(price * 0.8, asJsonObject2.getDouble("ActivityPrice"), "验证是否为八折价格");
			Logger.verifyEquals(price * 0.8, asJsonObject2.getDouble("ActivityPrice"), "验证是否为八折价格");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	//////////////////////////// case 忽略 优选业务下架////////////////////
	
	private static int globalSellerId = Integer.parseInt(EnvSetup.getData("globalSellerId"));
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_022() {
		Logger.start(true, "查询优选团价格，多佣金比例");
		try {
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV2
					.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addSellerProductRequest).get("Data")
					.getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(globalSellerId, productId, 2);
			// 设置佣金比例、获取规格id、根据规格id，商品id，修改商品佣金
			BigDecimal saleCommission = new BigDecimal("0.111");
			List<String> catalogIds = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream()
					.map(x -> x.getsCatalogId()).collect(Collectors.toList());
			ProductManagerCallServiceV2.UpdateCatalogCommisions(addSellerProductRequest.getSellerId(), productId,
					catalogIds.get(0), addSellerProductRequest.getSellerName(), saleCommission);
			ProductManagerCallServiceV2.UpdateCatalogCommisions(addSellerProductRequest.getSellerId(), productId,
					catalogIds.get(1), addSellerProductRequest.getSellerName(), saleCommission);
			
			Thread.sleep(4000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonArray asJsonArray = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList").get(0).getAsJsonObject().getAsJsonArray("CatalogList");
			//判断各个佣金价格
			asJsonArray.forEach(j->{
				JsonObject cataLog = j.getAsJsonObject();
				float price = cataLog.get("Price").getAsFloat();
				JsonArray CommissionList = cataLog.getAsJsonArray("CommissionList");
				Logger.verifyEquals(String.format("%.2f",Math.floor(price*0.6*saleCommission.floatValue()*100)/100),String.format("%.2f",CommissionList.get(0).getAsDouble()), "验证V1佣金");
				Logger.verifyEquals(String.format("%.2f",Math.floor(price*0.7*saleCommission.floatValue()*100)/100),String.format("%.2f",CommissionList.get(1).getAsDouble()), "验证V2佣金");
				Logger.verifyEquals(String.format("%.2f",Math.floor(price*0.83*saleCommission.floatValue()*100)/100),String.format("%.2f",CommissionList.get(2).getAsDouble()), "验证V3佣金");
				Logger.verifyEquals(String.format("%.2f",Math.floor(price*0.96*saleCommission.floatValue()*100)/100),String.format("%.2f",CommissionList.get(3).getAsDouble()), "验证V4佣金");
			});
			
			
			}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_023() {
		Logger.start(true, "查询礼包商品，多佣金比例");
		try{
			AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(globalSellerId);
			String productId = ProductManagerCallServiceV2.addNewProduct(addSellerProductRequest).get("Data").getAsJsonObject().get("ProductId").getAsString();
			ProductManagerCallServiceV2.AddSellerGlobalPspProduct(globalSellerId,productId,1);
			Thread.sleep(3000);
			ProductManagerCallServiceV3.productMongocrudSync(productId, "CreateProduct",0);
			List<BigDecimal> saleCommissions = Arrays.asList(new BigDecimal("0.0700"),new BigDecimal("0.0800"),new BigDecimal("0.0900"),new BigDecimal("0.1000"));
			List<String> catalogIds = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(x->x.getsCatalogId()).collect(Collectors.toList());
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(globalSellerId,productId,catalogIds.get(0),addSellerProductRequest.getSellerName(), saleCommissions);
			ProductManagerCallServiceV2.UpdateCatalogCommisionsV2(globalSellerId,productId,catalogIds.get(1),addSellerProductRequest.getSellerName(), saleCommissions);

			Thread.sleep(4000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonArray asJsonArray = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList").get(0).getAsJsonObject().getAsJsonArray("CatalogList");
			//判断各个佣金价格
			asJsonArray.forEach(j->{
				JsonObject cataLog = j.getAsJsonObject();
				float price = cataLog.get("Price").getAsFloat();
				JsonArray CommissionList = cataLog.getAsJsonArray("CommissionList");
				Logger.verifyEquals(String.format("%.2f",price*saleCommissions.get(0).floatValue()),String.format("%.2f",CommissionList.get(0).getAsDouble()), "验证V1佣金");
				Logger.verifyEquals(String.format("%.2f",price*saleCommissions.get(1).floatValue()),String.format("%.2f",CommissionList.get(1).getAsDouble()), "验证V2佣金");
				Logger.verifyEquals(String.format("%.2f",price*saleCommissions.get(2).floatValue()),String.format("%.2f",CommissionList.get(2).getAsDouble()), "验证V3佣金");
				Logger.verifyEquals(String.format("%.2f",price*saleCommissions.get(3).floatValue()),String.format("%.2f",CommissionList.get(3).getAsDouble()), "验证V4佣金");
			});
			
			
			}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_024() {
		Logger.start(true, "价格服务增加币种");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(3000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonObject product = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data")
					.getAsJsonArray("ProductList").get(0).getAsJsonObject();
			Logger.verifyNotNull(product.getAsJsonObject("CurrencyExchangeRate").get("OnshoreExchangeRate")
					.getAsBigDecimal().doubleValue(), "商品标价货币和参考汇率--美元");
			Logger.verifyEquals(product.getAsJsonObject("MarketCurrencyExchangeRate").get("OnshoreExchangeRate")
					.getAsBigDecimal().doubleValue(), 1.0, "商品市场价货币和参考汇率-人民币");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetProductDetailListByProductIdList_025() {
		Logger.start(true, "审核中商品做删除处理");
		try{
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setSecondCategoryId(1804);
			String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Thread.sleep(3000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonObject product = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList").get(0).getAsJsonObject();
			Logger.verifyEquals(-1,product.get("Status").getAsInt(),"审核中商品做删除处理");
			}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_026() {
		Logger.start(true, "审核失败商品做删除处理");
		try{
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setSecondCategoryId(1804);
			String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Thread.sleep(3000);
			ProductManagerCallServiceV3.UpdateAuditStatus(productId, -1);
			Thread.sleep(3000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonObject product = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList").get(0).getAsJsonObject();
			Logger.verifyEquals(-1,product.get("Status").getAsInt(),"审核失败商品做删除处理");
			}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_027() {
		Logger.start(true, "审核通过商品不做删除处理");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setSecondCategoryId(1804);
			String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject()
					.get("ProductId").getAsString();
			Thread.sleep(3000);
			ProductManagerCallServiceV3.UpdateAuditStatus(productId, 0);
			Thread.sleep(3000);
			
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonObject product = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data")
					.getAsJsonArray("ProductList").get(0).getAsJsonObject();
			Logger.verifyEquals(0, product.get("Status").getAsInt(), "审核中商品做删除处理");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_028() {
		Logger.start(true, "查询商品标签Tag");
		try{
			AddSellerProductRequest addProdReq =ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(3383);
			addProdReq.getProduct().setProductTags(Arrays.asList("测试Tag1","测试Tag2"));
			String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
			Thread.sleep(3000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId));
			JsonObject product = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList").get(0).getAsJsonObject();
			Logger.verifyEquals("测试Tag1",product.getAsJsonArray("Tag").get(0).getAsString(),"验证Tag1");
			Logger.verifyEquals("测试Tag2",product.getAsJsonArray("Tag").get(1).getAsString(),"验证Tag2");
			}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_GetProductDetailListByProductIdList_029() {
		Logger.start(true, "查询商品列表，未露出的不显示");
		try{
			Integer sellerId = GodmchManageCallService.CreateGodMch();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,"", true);
			AddAgentProductBean addAgentProductBean1 = AddAgentProductCallService.initAddAgentProduct(sellerId,"", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			String productId1 = AddAgentProductCallService.AddAgentProduct(addAgentProductBean1);
			AddAgentProductCallService.SetVisible(sellerId, Arrays.asList(productId), true);
			Thread.sleep(3000);
			getProductDetailListByProductIdListCall.search(Arrays.asList(productId,productId1));
			JsonArray productList = getProductDetailListByProductIdListCall.getJsonObject().getAsJsonObject("Data").getAsJsonArray("ProductList");
			Logger.verifyEquals(1, productList.size(), "只查询出了露出的");
			Logger.verifyEquals(productId1, productList.get(0).getAsJsonObject().get("ProductId").getAsString(), "只查询出了露出的");
			
			}catch(Exception e){
			Logger.fail(e);
		}
	}

	

	public static void checkByProductId(List<String> prodList,int prodInActivityId,int prodInNextActivityId,int liveId,boolean isTradeIsolation,boolean IgnoreActivityConf) throws Exception{
		YMTDateUtil.waitTime(2);
		List<ProductInDetailBean> tgtProdInDetailBeanList = new ArrayList<>();
		prodList.forEach(ele->{
			try {
				tgtProdInDetailBeanList.add(ProductQueryCallService.getProductInDetailBean(ele, prodInActivityId, prodInNextActivityId, liveId));
			} catch (Exception e) {
				e.printStackTrace();
			}
		});
		
		
		JSONObject ret;
		String chkdesc;
		if (isTradeIsolation){
			//交易隔离接口
			ret = getProductDetailListByTradeIsolationCall.searchByActivityConf(prodList,IgnoreActivityConf);
			chkdesc = "检查 GetProductDetailListByTradeIsolation";
		}else{
			
			//普通交易不隔离接口
			ret = getProductDetailListByProductIdListCall.searchByActivityConf(prodList,IgnoreActivityConf);
			chkdesc = "检查 GetProductDetailListByProductIdList";
		}
		
		//返回码检查
		Logger.verifyEquals(200, ret.getInt("Code"), "返回码检查");
		
		
		//返回值取数据
		List<ProductInDetailBean> actProdInDetailBeanList = new ArrayList<>();
		JSONArray prodListAry = ret.getJSONObject("Data").getJSONArray("ProductList");
		for(int i=0;i<prodListAry.length();i++){
			actProdInDetailBeanList.add(ProductQueryCallService.getBeanFromJson(prodListAry.getJSONObject(i),ProductInDetailBean.class));
		}
		
		//比对
		ProductQueryCallService.compareProductInDetailBean(prodList,tgtProdInDetailBeanList, actProdInDetailBeanList,chkdesc);
	}
	
	
	
	
	
	
	
	
	
}
